<?php include 'header-inc.php'; ?>

    <div id="inner-wrap">
        <div id="sidebar">
<?php include 'sidebar-inc.php'; ?>

        </div>
        <div id="content-box">
            <div class="inner-box">
                <div class="cmd">
                    <ul>
                        <li><a href="<?php echo $this->_url($_GET[FLEA::getAppInf( 'controllerAccessor' )], 'categories', array(array(FLEA::getAppInf( 'columnAccessor' ) => $_colkey))); ?>">返回新闻分类</a></li>
                        <li><a href="<?php echo $this->_url($_GET[FLEA::getAppInf( 'controllerAccessor' )], 'sortcategory', array(array(FLEA::getAppInf( 'columnAccessor' ) => $_colkey))); ?>">分类排序</a></li>
                    </ul>
                </div>
                <div class="formbox box">
                <form method="post" action="<?php echo $this->_url('news', 'savecategory'); ?>" enctype="multipart/form-data">
                    <h3>新闻分类</h3>
                    <table>
                        <tr style="display:none">
                            <th>所属分类：</th>
                            <td>
                                <select id="parent_id" name="parent_id">
                                    <option value="0">作为一级分类</option>
                                    <?php foreach($data['categories'] as $cate): ?>
                                    <?php if($cate['cate_id']!=$data['row']['cate_id']): ?>
                                    <?php if($data['row']['parent_id']==$cate['cate_id']) { $selected = ' selected="selected"'; } ?>
                                    <?php if($_GET['cate_id']==$cate['cate_id'] && $_GET[FLEA::getAppInf( 'actionAccessor' )]=='addcategory') { $selected = ' selected="selected"'; } ?>
                                    <option value="<?php echo $cate['cate_id']; ?>"<?php echo $selected; ?>><?php echo $cate['name']; ?></option>
                                    <?php endif; ?>
                                    <?php endforeach; ?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>分类名称：</th>
                            <td><input type="text" id="name" name="name" value="<?php echo h($data['row']['name']); ?>" /></td>
                        </tr>
                        <tr>
                            <th>分类描述：</th>
                            <td><textarea id="description" name="description" rows="5"><?php echo h($data['row']['description']); ?></textarea></td>
                        </tr>
                        <?php if($data['row']['attachments']): ?>
                        <?php FLEA::loadFile( 'helper_common' ); ?>
                        <tr>
                            <th>查看图片：</th>
                            <td><?php echo getImg($data['row']['attachments'], 'thumb'); ?></td>
                        </tr>
                        <?php endif; ?>
                        <tr style="display:none">
                            <th>分类图片：</th>
                            <td><input type="file" id="pic" name="pic" /></td>
                        </tr>
                        <tr>
                            <th></th>
                            <td><input type="submit" value="保 存" /> <input type="reset" value="重 置" /></td>
                        </tr>
                    </table>
                    <input type="hidden" id="cate_id" name="cate_id" value="<?php echo $data['row']['cate_id']; ?>" />
                    <input type="hidden" id="site_id" name="site_id" value="<?php echo $_GET['site']; ?>" />
                    <input type="hidden" id="colkey" name="colkey" value="<?php echo $_GET[FLEA::getAppInf( 'columnAccessor' )]; ?>" />
                </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
